package cn.quevo.cube.provide.define.entity.dto;

import cn.quevo.cube.provide.define.entity.CubeColumnExt;
import cn.quevo.cube.provide.define.entity.CubeColumnItem;
import cn.quevo.cube.provide.define.entity.CubeColumnSequence;
import cn.quevo.cube.provide.define.entity.CubeModelColumn;
import cn.quevo.cube.provide.define.enums.ColumnTypeCode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.Map;

/**
 * 字段参数接收基础DTO
 *
 * @author July july_sky@foxmail.com
 * @version 1.0
 * @date 2018/12/11 4:09 PM
 * @Copyright 湘豫（北京）科技有限公司版权所有.All Rights Reserved.
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class CubeColumnDto extends CubeModelColumn {

    /** 起始值 */
    private Long startValue;
    /** 增量 */
    private Long stepInt;
    /** 序列 */
    private CubeColumnSequence cubeColumnSequence;
    /** 字段扩展信息 */
    private Map<String, CubeColumnExt> exts;
    /** 枚举选项值列表 */
    private List<CubeColumnItem> items;
    /**
     * 是否序列
     *
     * @return
     * @author July july_sky@foxmail.com
     * @date 2018-04-24 22:34:25
     * @Copyright ©2015-2035 湘豫(北京)科技有限公司. All Rights Reserved.
     * @version 1.0
     */
    public boolean isSequence() {
        return ColumnTypeCode.AUTO_SEQUENCE.name().equalsIgnoreCase(this.getTypeCode()) || ColumnTypeCode.DATE_SEQUENCE.name().equalsIgnoreCase(this.getTypeCode());
    }

    /*public boolean isChose() {
        return !StringUtils.isEmpty(extColumn) && !StringUtils.isBlank(extColumn.get("choseValues"));
    }*/
}

